import 'dart:core';

import 'package:cc_sdk/models/json_interface.dart';

class PagerResult<T> implements IJsonModel<PagerResult> {
  int pageSize;
  int pageIndex;
  int recordCount;
  int pageCount;
  List<T> list;

  PagerResult.fromMap(
      Map<String, dynamic> map, T convert(Map<String, dynamic> item)) {
    pageSize = int.parse(map["pageSize"].toString());
    pageIndex = int.parse(map["pageIndex"].toString());
    recordCount = int.parse(map["recordCount"].toString());
    pageCount = int.parse(map["pageCount"].toString());
    list = [];

    if (map["list"] != null && map["list"].length > 0) {
      var childs = map["list"] as List<dynamic>;
      for (var item in childs) {
        var model = item as Map<String, dynamic>;
        list.add(convert(model));
      }
    }
  }
}
